/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       item_help_block.h

	$Header: /game/interface_help.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef ITEM_HELP_BLOCK_H_INCLUDED
#define ITEM_HELP_BLOCK_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#pragma warning( disable: 4786 )

#include <map>
#include <string>
#include "counted_ptr.h"
#include "string_insensitive_compare.h"

class t_window;

struct t_item_help : public t_counted_object
{
	std::string name;
	std::string help_text;

	t_item_help( std::string const& new_name, std::string const& help )
	{
		name = new_name;
		help_text = help;
	}
};

typedef t_counted_ptr<t_item_help> t_item_help_ptr;

// ---------------------------------------------------------------
// block of related help items
// ---------------------------------------------------------------
class t_help_block : public t_counted_object
{
public:
	void add( std::string const& keyword, std::string const& name, std::string const& help );

	std::string get_name( std::string const& keyword ) const;
	std::string get_help( std::string const& keyword ) const;
	t_item_help const& operator[] (std::string const& keyword ) const;
protected:
	typedef std::map< std::string, t_item_help_ptr, t_string_insensitive_less > t_map;

	t_map m_map;
};

inline void t_help_block::add( std::string const& keyword, std::string const& name, 
							   std::string const& help )
{
	m_map[keyword] = new t_item_help( name, help );
}


#endif // ITEM_HELP_BLOCK_H_INCLUDED